#include"processBar.h"
const char* lable = "|/-\\";
void processBar1(int rate){

    int count=0;
    size_t len=strlen(lable);
    char str[NUMS ];
    memset(str,'\0',sizeof(str));
    while(count<=COUNT){
        printf("[%-100s]""[%d%][%c]\r",str,count*100/COUNT,lable[count%len]);
       fflush(stdout);
        str[count++]=TYPE;
        if(count< 100)
          str[count]=SYMBOL;
        usleep(100000 );
    }
    putchar('\n');
}

void Init(){
  memset(str,'\0',sizeof(str));
}

void processBar2(int rate){
  if(rate<0||rate>100) return;
  size_t len=strlen(lable);
  printf(BLUE"[%-100s]"NONE"[%d%][%c]\r",str,rate,lable[rate%len]);
  str[rate++]=TYPE;
  if(rate <100)
    str[rate ]=SYMBOL;
  fflush(stdout);
}
